﻿@using WebUI.Areas.Admin.Models
@model RoleInfoForEditViewModel
@{
	Layout = "~/Areas/Admin/Views/Shared/_AdminContent.cshtml";
}
@section body {
	<script>
		function onComplete(data) {
			console.log(data);
			$("#js-message").fadeIn();
			var resJson = data.responseJSON;
			if (resJson.code <= 0) {
				$("#js-message").attr("class", "alert alert-danger").find(".message").html(resJson.message)
			} else {
				$("#js-message").attr("class", "alert alert-success").find(".message").html(resJson.message);
			}
			// 3s 后隐藏
			setTimeout(function () {
				$("#js-message").fadeOut("slow");
			}, 3000);
		}
	</script>
}
<!-- start 提示框 -->
@Html.Partial("_MessagePartial")
<!-- end 提示框 -->

@using (Ajax.BeginForm("Edit", new AjaxOptions
{
	HttpMethod = "Post",
	OnComplete = "onComplete"
}))
{
	<div class="input-group">
		@Html.TextBoxFor(m => m.ID, new { @class = "form-control", @readonly = "readonly" })
		@Html.TextBoxFor(m => m.Name, new { @class = "form-control" })
	</div>
	<div class="btn-group">
		@if (TempData["RedirectUrl"] != null)
		{
			<a class="btn btn-default" href="@TempData["RedirectUrl"].ToString()">返回</a>
		}
		else
		{
			<a class="btn btn-default" href="javascript:history.go(-1);">返回</a>
		}
		<input class="btn btn-primary" type="submit" value="保存" />
	</div>
}


